<extend name="./public/frame.html"/>
<block name="content">
    <!--<form class="layui-form" action="{:url('submits')}" method="post" enctype="multipart/form-data">-->
    <form class="layui-form" action="" method="post" enctype="multipart/form-data" id="formId" autocomplete="off">
        <input type="hidden" name="car_id" value="{$car_id}"/>
        <input type="hidden" name="driver_id" value="{$info.driver_id}"/>
        <table class="layui-table">
            <tr>
                <td colspan="2" style="font-weight: bold;font-size: 16px;color: black;">车主认证</td>
            </tr>
            <tr>
                <td colspan="2">
                    <table class="layui-table">
                        <tr>
                            <td style="font-weight: bold;color: black; background:#F8F8F8" colspan="2">
                                <input type="text" class="layui-input" readonly value="认证信息" style="border: 0px;width: 30%;float: left;background:#F8F8F8">
                            </td>
                        </tr>
                        <tr>
                            <td style="width: 10%;text-align: center;">认证城市</td>
                            <td>{$info.region_name_province}{$info.region_name_city}</td>
                        </tr>
                        <tr>
                            <td style="width: 10%;text-align: center;">认证类型</td>
                            <td><?php echo $info['auth_type'];?></td>
                        </tr>
                    </table>
                </td>
            </tr>
            <tr>
                <td colspan="2">
                    <table class="layui-table">
                        <tr>
                            <td style="font-weight: bold;color: black; background:#F8F8F8" colspan="2">
                                <input type="text" class="layui-input" readonly value="身份证信息" style="border: 0px;width: 30%;float: left;background:#F8F8F8">
                                <input type="checkbox" data-type="driverInfo" lay-skin="switch" lay-filter="switchCheck" class="check" lay-text="通过|未过" value="1" <?php if($check['driverInfo'] == 1):?>checked<?php endif;?>>
                            </td>
                        </tr>
                        <tr>
                            <td style="width: 10%;text-align: center;">真实姓名</td>
                            <td><?php echo $info['driver_name'];?></td>
                        </tr>
                        <tr>
                            <td style="width: 10%;text-align: center;">身份证号</td>
                            <td><?php echo $info['id_number'];?></td>
                        </tr>
                        <tr>
                            <td style="width: 10%;text-align: center;">身份证(正面/反面)</td>
                            <td class="layer-photos-demo">
                                <img src="<?php echo $info['id_front'];?>" style="width: 150px;height: 75px;">
                                <img src="<?php echo $info['id_back'];?>" style="width: 150px;height: 75px;">
                            </td>
                        </tr>
                        <tr>
                            <td style="width: 10%;text-align: center;">手持身份证照片</td>
                            <td class="layer-photos-demo">
                                <img src="<?php echo $info['id_hold'];?>" style="width: 150px;height: 75px;">
                            </td>
                        </tr>
                    </table>
                </td>
            </tr>
            <tr>
                <td colspan="2">
                    <table class="layui-table">
                        <tr>
                            <td style="font-weight: bold;color: black; background:#F8F8F8" colspan="2">
                                <input type="text" class="layui-input" readonly value="驾驶证信息" style="border: 0px;width: 30%;float: left;background:#F8F8F8">
                                <input type="checkbox" data-type="licenseInfo" lay-skin="switch" lay-filter="switchCheck" class="check" lay-text="通过|未过" value="1" <?php if($check['licenseInfo'] == 1):?>checked<?php endif;?>>
                            </td>
                        </tr>
                        <tr>
                            <td style="width: 10%;text-align: center;">初次领证日期</td>
                            <td><?php echo $info['license_time'];?></td>
                        </tr>
                        <tr>
                            <td style="width: 10%;text-align: center;">驾驶证有效时期</td>
                            <td><?php echo $info['valid_time'];?></td>
                        </tr>
                        <tr>
                            <td style="width: 10%;text-align: center;">驾驶证</td>
                            <td class="layer-photos-demo">
                                <img src="<?php echo $info['license'];?>" style="width: 150px;height: 75px;">
                            </td>
                        </tr>
                    </table>
                </td>
            </tr>
            <tr>
                <td colspan="2">
                    <table class="layui-table">
                        <tr>
                            <td style="font-weight: bold;color: black; background:#F8F8F8" colspan="2">
                                <input type="text" class="layui-input" readonly value="车辆信息" style="border: 0px;width: 30%;float: left;background:#F8F8F8">
                                <input type="checkbox" data-type="carInfo" lay-skin="switch" lay-filter="switchCheck" class="check" lay-text="通过|未过" value="1" <?php if($check['carInfo'] == 1):?>checked<?php endif;?>>
                            </td>
                        </tr>
                        <tr>
                            <td style="width: 10%;text-align: center;">品牌型号</td>
                            <td><?php echo $info['car_brand'];?> - <?php echo $info['car_model'];?></td>
                        </tr>
                        <tr>
                            <td style="width: 10%;text-align: center;">车辆颜色</td>
                            <td><?php echo $info['color'];?></td>
                        </tr>
                        <tr>
                            <td style="width: 10%;text-align: center;">座位数</td>
                            <td><?php echo $info['seats'];?></td>
                        </tr>
                        <tr>
                            <td style="width: 10%;text-align: center;">所属公司</td>
                            <td>{$info.company|default="无"}</td>
                        </tr>
                        <tr>
                            <td style="width: 10%;text-align: center;">车辆图片</td>
                            <td class="layer-photos-demo">
                                <img src="<?php echo $info['body_img'];?>" style="width: 150px;height: 75px;">
                            </td>
                        </tr>
                    </table>
                </td>
            </tr>
            <tr>
                <td colspan="2">
                    <table class="layui-table">
                        <tr>
                            <td style="font-weight: bold;color: black; background:#F8F8F8" colspan="2">
                                <input type="text" class="layui-input" readonly value="行驶证信息" style="border: 0px;width: 30%;float: left;background:#F8F8F8">
                                <input type="checkbox" data-type="permitInfo" lay-skin="switch" lay-filter="switchCheck" class="check" lay-text="通过|未过" value="1" <?php if($check['permitInfo'] == 1):?>checked<?php endif;?>>
                            </td>
                        </tr>
                        <tr>
                            <td style="width: 10%;text-align: center;">车辆所有人</td>
                            <td><?php echo $info['owner'];?></td>
                        </tr>
                        <tr>
                            <td style="width: 10%;text-align: center;">车牌号</td>
                            <td><?php echo $info['car_plate'];?></td>
                        </tr>
                        <tr>
                            <td style="width: 10%;text-align: center;">发动机号</td>
                            <td><?php echo $info['vin'];?></td>
                        </tr>
                        <tr>
                            <td style="width: 10%;text-align: center;">车辆注册日期</td>
                            <td><?php echo $info['register_at'];?></td>
                        </tr>
                        <tr>
                            <td style="width: 10%;text-align: center;">行驶证照片</td>
                            <td class="layer-photos-demo">
                                <img src="<?php echo $info['permit'];?>" style="width: 150px;height: 75px;">
                            </td>
                        </tr>
                    </table>
                </td>
            </tr>
            <tr>
                <td colspan="2">
                    <table class="layui-table">
                        <tr>
                            <td style="font-weight: bold;color: black; background:#F8F8F8" colspan="2">
                                <input type="text" class="layui-input" readonly value="司机背景信息调查" style="border: 0px;width: 30%;float: left;background:#F8F8F8">
                                <input type="checkbox" data-type="driverDataCheck" lay-skin="switch" lay-filter="switchCheck"  id="driveDataInfo" <?php if($info['backStatus'] != 2):?>disabled<?php endif;?> class="check" lay-text="通过|未过" value="1" <?php if($check['driverDataCheck'] == 1):?>checked<?php endif;?>>
                            </td>
                        </tr>
                        <tr>
                            <td style="width: 10%;text-align: center;">查询结果</td>
                            <td>
                                <?php if($info['backStatus'] == 2):?>
                                <span style="color:green;">查询成功</span>
                                <?php elseif($info['backStatus'] == 1):?>
                                查询中
                                <?php elseif($info['backStatus'] == 0):?>
                                待查询
                                <?php elseif($info['backStatus'] == 3):?>
                                <span style="color:red;">查询失败</span>
                                <?php endif;?>
                            </td>
                        </tr>
                        <?php if($info['backStatus'] == 2):?>
                        <tr>
                            <td style="width: 10%;text-align: center;">前科</td>
                            <td>
                                <?php if(in_array('1',$info['resultContent'])):?>
                                <span style="color:red;">命中</span>
                                <?php else:?>
                                无
                                <?php endif;?>
                            </td>
                        </tr>
                        <tr>
                            <td style="width: 10%;text-align: center;">涉毒/吸毒</td>
                            <td>
                                <?php if(in_array('2',$info['resultContent'])):?>
                                <span style="color:red;">命中</span>
                                <?php else:?>
                                无
                                <?php endif;?>
                            </td>
                        </tr>
                        <tr>
                            <td style="width: 10%;text-align: center;">在逃</td>
                            <td>
                                <?php if(in_array('3',$info['resultContent'])):?>
                                <span style="color:red;">命中</span>
                                <?php else:?>
                                无
                                <?php endif;?>
                            </td>
                        </tr>
                        <tr>
                            <td style="width: 10%;text-align: center;">道德风险</td>
                            <td>
                                <?php if(in_array('4',$info['resultContent'])):?>
                                <span style="color:red;">命中</span>
                                <?php else:?>
                                无
                                <?php endif;?>
                            </td>
                        </tr>
                        <?php endif;?>
                        <tr>
                            <td style="width: 10%;text-align: center;">查询时间</td>
                            <td id="driverInfoTime"><?php echo $info['time'];?></td>
                        </tr>
                    </table>
                </td>
            </tr>

            <if condition="$info.auth_type == '出租车'">
            <tr>
                <td colspan="2">
                    <table class="layui-table">
                        <tr>
                            <td style="font-weight: bold;color: black; background:#F8F8F8" colspan="2">
                                <input type="text" class="layui-input" readonly value="营运车辆运输证与服务资格证" style="border: 0px;width: 30%;float: left;background:#F8F8F8">
                                <input type="checkbox" data-type="certificate" lay-skin="switch" lay-filter="switchCheck" class="check" lay-text="通过|未过" value="1" <?php if($check['certificate'] == 1):?>checked<?php endif;?>>
                            </td>
                        </tr>
                        <tr>
                            <td style="width: 10%;text-align: center;">营运车辆运输证</td>
                            <td class="layer-photos-demo">
                                <img src="<?php echo $info['taxi'];?>" style="width: 150px;height: 75px;">
                            </td>
                        </tr>
                        <tr>
                            <td style="width: 10%;text-align: center;">服务资格证</td>
                            <td class="layer-photos-demo">
                                <img src="<?php echo $info['taxi_certificate'];?>" style="width: 150px;height: 75px;">
                            </td>
                        </tr>
                    </table>
                </td>
            </tr>
            </if>
            <!------------------------------------------车险信息------------------------------------------->
            <?php if(!empty($info['car_vin'])):?>
            <!--<tr>
                <td colspan="2">
                    <table class="layui-table">
                        <tr>
                            <td style="font-weight: bold;color: black; background:#F8F8F8" colspan="2">
                                <input type="text" class="layui-input" readonly value="车险在保信息" style="border: 0px;width: 30%;float: left;background:#F8F8F8">
                                <input type="checkbox" data-type="insurance" lay-skin="switch" lay-filter="switchCheck" class="check" id="checkCarResult" lay-text="通过|未过" value="1" <?php if($info['comm_pass'] == 1 && $info['sail_pass'] == 1):?>checked<?php endif;?>>
                                <input type="hidden" name="bdStauts" id="bdStauts" value="<?php if($info['comm_pass'] == 1 && $info['sail_pass'] == 1):?>1<?php else:?>3<?php endif;?>">
                            </td>
                        </tr>
                        <tr>
                            <td style="width: 10%;text-align: center;">查询结果</td>
                            <td><?php if(!empty($info['code'])):?><span style="color: green">查询成功</span><?php else:?><span>等待查询</span><?php endif;?></td>
                        </tr>
                        <?php if(!empty($info['code'])):?>
                        <tr>
                            <td style="width: 10%;text-align: center;">查询时间</td>
                            <td><?php if(!empty($info['code_time'])):?><?php echo date("Y-m-d H:i:s",$info['code_time']);?><?php endif;?></td>
                        </tr>
                        <?php endif;?>
                        <?php if($info['code'] == 200):?>

                        <?php if(empty($info['car_insurance']['itemData'])):?>
                        <tr>
                            <td style="width: 10%;text-align: center;">车险信息</td>
                            <td>未查询到车险信息</td>
                        </tr>
                        <?php else:?>
                        <tr>
                            <td style="width: 10%;color: green" colspan="2">车险信息</td>
                        </tr>
                        <?php foreach($info['car_insurance']['itemData'] as $key=>$value):?>
                        <?php if($value['set'] == 1):?>
                        <tr>
                            <td style="color: green" colspan="2"><?php echo $value['itemPropLabel'];?></td>
                        </tr>
                        <tr>
                            <td colspan="2">
                                <table class="layui-table">
                                    <?php if($value['itemPropName'] == 'insuranceInfoC'):?>
                                    <?php foreach($value['itemPropValue'] as $vml):?>
                                    <tr>
                                        <td style="width: 10%;text-align: center;">险种名称(代码)</td>
                                        <td><?php echo $vml[1]['itemPropValue'];?>（<span style="color: green;"><?php if(!empty($vml[0]['itemPropValue'])):?><?php echo $vml[0]['itemPropValue'];?><?php else:?>无<?php endif;?></span>）</td>
                                    </tr>
                                    <?php endforeach;?>
                                    <?php elseif($value['itemPropName'] == 'insuranceInfoD'):?>
                                    <?php foreach($value['itemPropValue'] as $vml):?>
                                    <tr>
                                        <td style="width: 10%;text-align: center;">险种名称/保额/保险/</td>
                                        <td>
                                            <span style="color: green;"><?php if($vml[2]['itemPropValue']):?><?php echo $vml[2]['itemPropValue'];?><?php else:?>无<?php endif;?></span> -
                                            （<span style="color: green;"><?php if($vml[0]['itemPropValue']):?><?php echo $vml[0]['itemPropValue'];?><?php else:?>无<?php endif;?></span>） -
                                            （<span style="color: green;"><?php if($vml[1]['itemPropValue']):?><?php echo $vml[1]['itemPropValue'];?><?php else:?>无<?php endif;?></span>）
                                        </td>
                                    </tr>
                                    <?php endforeach;?>
                                    <?php else:?>
                                    <?php foreach($value['itemPropValue'] as $vml):?>
                                    <?php foreach($vml as $vll):?>
                                    <tr>
                                        <td style="width: 10%;text-align: center;"><?php echo $vll['itemPropLabel'];?></td>
                                        <td><?php if(!empty($vll['itemPropValue'])):?><?php echo $vll['itemPropValue'];?><?php endif;?></td>
                                    </tr>
                                    <?php endforeach;?>
                                    <?php endforeach;?>
                                    <?php endif;?>
                                </table>
                            </td>
                        </tr>
                        <?php else:?>
                        <tr>
                            <td style="width: 10%;text-align: center;"><?php echo $value['itemPropLabel'];?></td>
                            <td><?php if(!empty($value['itemPropValue'])):?><?php echo $value['itemPropValue'];?><?php endif;?></td>
                        </tr>
                        <?php endif;?>
                        <?php endforeach;?>
                        <?php endif;?>

                        <?php else:?>
                        <?php if(!empty($info['code'])):?>
                        <tr>
                            <td style="width: 10%;text-align: center;">错误代码</td>
                            <td><?php echo $info['errorCode'];?></td>
                        </tr>
                        <tr>
                            <td style="width: 10%;text-align: center;">错误信息</td>
                            <td><?php echo $info['errorMsg'];?></td>
                        </tr>
                        <?php endif;?>
                        <?php endif;?>
                    </table>
                </td>
            </tr>-->
            <?php endif;?>
            <!------------------------------------------车险信息------------------------------------------->
            <tr>
                <td colspan="2">
                    <table class="layui-table">
                        <tr>
                            <td style="font-weight: bold;color: black; background:#F8F8F8" colspan="2">
                                <input type="text" class="layui-input" readonly value="保单信息" style="border: 0px;width: 30%;float: left;background:#F8F8F8">
                                <input type="checkbox" data-type="insurance" lay-skin="switch" lay-filter="switchCheck" class="check" lay-text="通过|未过" value="1" <?php if($info['comm_pass'] == 1 && $info['sail_pass'] == 1 && $info['carriage_pass'] == 1):?>checked<?php endif;?>>
                                <input type="hidden" name="bdStauts" id="bdStauts" value="<?php if($info['comm_pass'] == 1 && $info['sail_pass'] == 1 && $info['carriage_pass'] == 1):?>1<?php else:?>3<?php endif;?>">
                            </td>
                        </tr>
                        <tr>
                            <td style="width: 10%;text-align: center;">商业险失效日期</td>
                            <td>
                                <input type="text" class="layui-input" id="commerceinsurance_time" value="<?php echo $info['commerceinsurance_time'];?>" name="commerceinsurance_time" placeholder="yyyy-MM-dd">
                            </td>
                        </tr>
                        <tr>
                            <td style="width: 10%;text-align: center;">交强险失效日期</td>
                            <td>
                                <input type="text" class="layui-input" id="sail_time" value="<?php echo $info['sail_time'];?>" name="sail_time" placeholder="yyyy-MM-dd">
                            </td>
                        </tr>
                        <tr>
                            <td style="width: 10%;text-align: center;">承运险失效日期</td>
                            <td>
                                <input type="text" class="layui-input" id="carriage_time" value="<?php echo $info['carriage_time'];?>" name="carriage_time" placeholder="yyyy-MM-dd">
                            </td>
                        </tr>
                        <tr>
                            <td style="width: 10%;text-align: center;">车辆商业险</td>
                            <td class="layer-photos-demo">
                                <a href="<?php echo $info['commerceinsurance'];?>" target="_blank"><img src="<?php echo $info['commerceinsurance'];?>" id="commerceinsurance_pic" style="width: 150px;height: 75px;"></a>&nbsp;&nbsp;&nbsp;&nbsp;
                                <input name="commerceinsurance" id="commerceinsurance" type="hidden" value="">
                                <button type="button" class="layui-btn commerceinsurance"  id="upload-commerceinsurance" >上传图片</button>
                            </td>
                        </tr>
                        <tr>
                            <td style="width: 10%;text-align: center;">车辆交强险</td>
                            <td class="layer-photos-demo">
                                <a href="<?php echo $info['sail'];?>" target="_blank"><img src="<?php echo $info['sail'];?>" id="sail_pic" style="width: 150px;height: 75px;"></a>&nbsp;&nbsp;&nbsp;&nbsp;
                                <input name="sail" id="sail" type="hidden" value="">
                                <button type="button" class="layui-btn sail"  id="upload-sail}" >上传图片</button>
                            </td>
                        </tr>
                        <tr>
                            <td style="width: 10%;text-align: center;">车辆承运险</td>
                            <td class="layer-photos-demo">
                                <a href="<?php echo $info['carriage'];?>" target="_blank"><img src="<?php echo $info['carriage'];?>" id="carriage_pic" style="width: 150px;height: 75px;"></a>&nbsp;&nbsp;&nbsp;&nbsp;
                                <input name="carriage" id="carriage" type="hidden" value="">
                                <button type="button" class="layui-btn carriage"  id="upload-carriage}" >上传图片</button>
                            </td>
                        </tr>
                    </table>
                </td>
            </tr>

            <tr>
                <td colspan="2">
                    <table class="layui-table">
                        <tr>
                            <td style="font-weight: bold;color: black; background:#F8F8F8" colspan="2">
                                <input type="text" class="layui-input" readonly value="审核结果" style="border: 0px;width: 30%;float: left;background:#F8F8F8">
                                <input type="checkbox" data-type="checkResult" lay-skin="switch" id="checkResult" <?php if($info['backStatus'] != 2):?>disabled<?php endif;?> lay-filter="switchCheck" class="check" lay-text="通过|未过" value="1">
                                <input type="hidden" name="record_status" id="record_status" value="3" >
                            </td>
                        </tr>
                        <tr>
                            <td style="width: 10%;text-align: center;">未通过原因</td>
                            <td>
                                <textarea rows="3" class="layui-textarea" name="reason" id="reason"  maxlength="80" placeholder="请输入未通过原因"><?php echo $info['reason'];?></textarea>
                            </td>
                        </tr>
                        <tr>
                            <td style="width: 10%;text-align: center;">可选择标签</td>
                            <td>
                                <?php foreach($car_check_info as $key=>$value):?>
                                <input class="layui-input" type="checkbox" lay-filter="reasonType" value="<?php echo $value;?>" title="<?php echo $value;?>">
                                <?php endforeach;?>
                            </td>
                        </tr>
                    </table>
                </td>
            </tr>
            <style>
                .layui-form-checkbox{margin-top: 5px;}
            </style>
        </table>
        <?php if($info['backStatus'] != 2):?>
        <a class="layui-btn layui-btn-disabled">提交</a>
        <?php else:?>
        <button class="layui-btn" lay-submit="" lay-filter="submit" id="submits">提交</button>
        <?php endif;?>
        <button type="reset" class="layui-btn layui-btn-primary">重置</button>
    </form>
    <div class="fadeBg"></div>
    <div class="fadeCont" style="width: 20%;left: 40%;top: 30%">
        <div class="fadeBox upload">
            <img src="__WEB__/images/uploading.gif" style="width: 30%;height: auto">
            <p style="font-size: 12px;margin-bottom: 3px;">处理中，请稍等……</p>
        </div>
    </div>
    <script>
        layui.use(['form','laydate', 'upload'], function(){
            var form = layui.form
                ,layer = layui.layer
                ,upload = layui.upload
                    ,laydate = layui.laydate;
            layer.photos({
                photos: '.layer-photos-demo'
                ,anim: 5 //0-6的选择，指定弹出图片动画类型，默认随机（请注意，3.0之前的版本用shift参数）
                ,tab: function(pic, layero){
                    var str = "<div style='text-align: center'>"+pic.alt+"</div>";
                    layero.prepend(str);
                }
            });

            //保单
            upload.render({
                elem: '.commerceinsurance'//这个就等同于点击
                ,url: '/admin/Upload/upload'
                ,done:  function(res){ //上传后的回调
                    console.log(res)
                    if(res.status == 1){
                        $("#commerceinsurance_pic").attr('src',res.data.file); //点击后的大图
                        $("#commerceinsurance").val(res.data.file);
                        layer.msg('上传成功',{icon: 1});
                    }else{
                        layer.msg(res.msg);
                    }
                }
                ,error: function(e){
                    console.log(e)
                    //layer.msg('上传失败');

                }
            });
            upload.render({
                elem: '.sail'//这个就等同于点击
                ,url: '/admin/Upload/upload'
                ,done:  function(res){ //上传后的回调
                    console.log(res)
                    if(res.status == 1){
                        $("#sail_pic").attr('src',res.data.file); //点击后的大图
                        $("#sail").val(res.data.file);
                        layer.msg('上传成功',{icon: 1});
                    }else{
                        layer.msg(res.msg);
                    }
                }
                ,error: function(e){
                    console.log(e)
                    //layer.msg('上传失败');

                }
            });
            //承运险
            upload.render({
                elem: '.carriage'//这个就等同于点击
                ,url: '/admin/Upload/upload'
                ,done:  function(res){ //上传后的回调
                    console.log(res)
                    if(res.status == 1){
                        $("#carriage_pic").attr('src',res.data.file); //点击后的大图
                        $("#carriage").val(res.data.file);
                        layer.msg('上传成功',{icon: 1});
                    }else{
                        layer.msg(res.msg);
                    }
                }
                ,error: function(e){
                    console.log(e)
                    //layer.msg('上传失败');

                }
            });
            //常规用法
            laydate.render({
                elem: '#commerceinsurance_time'
            });
            laydate.render({
                elem: '#sail_time'
            });
            laydate.render({
                elem: '#carriage_time'
            });

            //执行实例预览
            var uploadInst = upload.render({
                elem: '#img_btn' //绑定元素
                ,field:'body_img'
                ,url:"{:url('upload')}"
                ,auto:false
                ,size:2048
                ,exts:'jpg|png|gif|bmp|jpeg'
                ,choose: function(obj){
                    //预读本地文件示例，不支持ie8
                    obj.preview(function(index, file, result){
                        $('#img_btn').hide();
                        $('#preview_div').show();
                        $('#preview_img').attr('src', result); //图片链接（base64）
                    });
                }
            });
            form.on('switch(switchCheck)', function(data){
                if(!this.checked){
                    var value = 0;
                }else{
                    var value = 1;
                }
                var key_name = $(this).data('type');
                if(key_name == 'checkResult'){
                    var record_status = $('#record_status').val();
                    if(data.elem.checked == true){
                        $('#record_status').val(1);
                    }else{
                        $('#record_status').val(3);
                    }
                }
                var car_id = $("input[name='car_id']").val();
                var url = '{:U("check_one")}';
                $.post(url,{'name':key_name,'value':value,'car_id':car_id},function(data){
                    console.log(data)
                })
            });
            form.on('checkbox(reasonType)', function(data){
                var reason = $("#reason").val();
                if(data.elem.checked == true){
                    if(reason == ''){
                        reason = data.value;
                    }else{
                        reason = reason+';'+data.value;
                    }
                }else{
                    var reg = new RegExp(data.value+';',"g");//g,表示全部替换。
                    var reason = reason.replace(reg,"");
                    var rega = new RegExp(data.value,"g");//g,表示全部替换。
                    var reason = reason.replace(rega,"");
                }
                $("#reason").val(reason);
            });
            //监听提交
            form.on('submit(submit)', function(data){
                //点击通过
                if($("#checkResult:checked").val() != 1 && $("#reason").val() ==''){
                    layer.msg('请填写未通过原因',{icon: 5});return false;
                }
            });
            $('#submits').click(function () {
                var formStr=$("#formId").serialize();
                var params = decodeURIComponent(formStr,true); //关键点
                $.post("{:url('/admin/Auth/ajax_submits')}", {
                    data:params
                }, function (res) {
                    switch (res.status){
                        case 1:
                            layer.msg(res['msg'],{icon: 6});
                            // 向java 提交 交通部接口数据
                            ajax_post_java(params);
                            layer.close(loading);
                            break;
                        default:
                            layer.msg(res['msg'],{icon: 5});
                            break;
                    }
                },'json');
                return false;
            });
        });

        function ajax_post_java(params) {
            $.ajax({
                url:"/admin/Auth/ajax_driver_info",
                type:"POST",
                data:params,
                contentType:"text/html;charset=utf8",
                dataType:"json",
                success:function (res) {
                    if(res.code === 200) {
                        console.log(res.msg);
                    } else {
                        console.log(res.msg);
                    }
                    parent.window.location.reload();
                }
            });
        }
    </script>
</block>
